package chapter02;

import java.util.Scanner;

public class Gouwu {
    public static void main(String[] args) {
        double yashua=8.8;
        double maojin=10.0;
        double shibei=18.8;
        double pinguo=12.5;
        double xiangjiao=15.5;
        int i=0;
        String a="Y";
        System.out.println("--------黑马小商城--------");
        System.out.println("1.牙刷的价格为："+yashua+"元");
        System.out.println("2.毛巾的价格为："+maojin+"元");
        System.out.println("3.水杯的价格为："+shibei+"元");
        System.out.println("4.苹果的价格为："+pinguo+"元");
        System.out.println("5.香蕉的价格为："+xiangjiao+"元");
        while (a.equals("Y")){
            Scanner scl=new Scanner(System.in);
            System.out.println("请输入你需要购买的");
            i = scl.nextInt();
            switch (i) {
                case 1:
                    System.out.println("请输入你要购买的牙刷数量：");
                    int ys = scl.nextInt();
                    double yss = ys * yashua;
                    System.out.println("您购买了" + ys + "牙刷,需要花费" + yss + "元");
                    System.out.println("需要继续购买请输入Y，否则输入N");
                    a = scl.next();
                    break;

                case 2:
                    System.out.println("请输入你要购买的毛巾数量：");
                    int mj = scl.nextInt();
                    double mjj = mj * maojin;
                    System.out.println("您购买了" + mj + "毛巾,需要花费" + mjj + "元");
                    System.out.println("需要继续购买请输入Y，否则输入N");
                    a = scl.next();
                    break;

                case 3:
                    System.out.println("请输入你要购买水杯的数量：");
                    int shui = scl.nextInt();
                    double shib = shui * shibei;
                    System.out.println("您购买了" + shui + "水杯,需要花费" + shib + "元");
                    System.out.println("需要继续购买请输入Y，否则输入N");
                    a = scl.next();
                    break;

                case 4:
                    System.out.println("请输入你要购买的苹果数量：");
                    int pni = scl.nextInt();
                    double ping = pni * pinguo;
                    System.out.println("您购买了" + pni + "苹果,需要花费" + ping + "元");
                    System.out.println("需要继续购买请输入Y，否则输入N");
                    a = scl.next();
                    break;

                case 5:
                    System.out.println("请输入你要购买的香蕉数量：");
                    int xj = scl.nextInt();
                    double xaing = xj * xiangjiao;
                    System.out.println("您购买了" + xj + "香蕉,需要花费" + xaing + "元");
                    System.out.println("需要继续购买请输入Y，否则输入N");
                    a = scl.next();
                    break;
            }
        }
    }
}
